package com.example.Laboratory.Service.Impl;

import com.example.Laboratory.Entity.Leader;
import com.example.Laboratory.Mapper.LeaderMapper;
import com.example.Laboratory.Service.LeaderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LeaderServiceImpl implements LeaderService {

    @Autowired
    LeaderMapper leaderMapper;

    //添加学科带头人信息
    @Override
    public String addLeader(Leader l) {
        if (leaderMapper.addLeader(l) == 1) {
            return "添加成功";
        } else {
            return "添加失败";
        }
    }

    //根据id删除学科带头人信息
    @Override
    public String deleteLeader(int leader_id) {
        if (leaderMapper.deleteLeader(leader_id) == 1) {
            return "删除成功";
        } else {
            return "删除失败";
        }
    }

    //查找全表信息
    @Override
    public List<Leader> researchLeader() {
        return leaderMapper.researchLeader();
    }

    //修改信息
    @Override
    public String reviseLeader(Leader l) {
        if (leaderMapper.reviseLeader(l) == 1) {
            return "修改成功";
        } else {
            return "修改失败";
        }
    }
}
